<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.css">
</head>
<body>
<div class="container">

    <form class="form-horizontal" th:action="@{/goods/insertGoods/}" method="post">
        <div class="form-group">
            <label for="NameId" class="col-sm-2 control-label">商品名称</label>
            <div class="col-sm-10">
                <input type="text" class="form-control" id="NameId" placeholder="姓名" name = "name">
            </div>
        </div>
        <div class="form-group">
            <label for="remarkId" class="col-sm-2 control-label">备注</label>
            <div class="col-sm-10">
                <textarea type="text" class="form-control"
                          cols="100" rows="5" id="remarkId" placeholder="备注" name = "remark"></textarea>
            </div>
        </div>

        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default" onclick="doInsertGoods()">确认</button>
            </div>
        </div>
    </form>

</div>

<script type="text/javascript">

    function doInsertGoods() {
        // forms[0] : 标记的是该页面中第一个出现的form 标签, 后面的
        let name = document.forms[0].name.value;
        alert(name);
        let remark = document.forms[0].remark.value;
        console.log(name + remark);
    }



</script>

</body>
</html>